Some useful UNIX Commands written down by Razor for newbies to get a start in UNIX 15th Jan. 2000 / 3:55 am
Part 1: Working with files and rights -------------------------------------
cp
mv
--- Copies the source file to dest --- Moves source to dest (if a directory, else it renames source to dest) --- Changes the current directory Shows the current directory Creates a directory --- Deletes a directory, if empty Deletes a whole directory with subdirectories (like DELTREE ) Deletes a file --- Changes the mode of a file user=(u)ser (current user) (g)roup (group of current user) (o)ther (all, except user&group) (a)ll (all :) ) MODE=(+) add rights (-) remove rights rights=(r)eadable (w)ritable e(x)ecutable --Shows free disk space ----------Searches the whole tree for a file (> Searches the path for a file Shows all files, which contain the Compares with Compares with and show
cd pwd mkdir rm rm -R rm chmod userMODErights
---------
df find / -name "" DIR /S) whereis grep -l "" given cmp diff the difference head tail
-----
between them Shows the first 10 lines of the file Shows the last 10 lines of the file
nl sort strings file wc
-----
Shows the lines of the file numbered Shows the lines of the file in sorted order --- Shows only the readable strings of a Shows lines, words, bytes of a file
---
file --- Gives information about a file touch -a -m -c -t MMDDhhmmCCYY --- Changes the timestamp of a file -a (Change Access-time) -m (Change Modification-time) -c (Don't create files, that don't exist) pico [file] script between this command --An easy to use ASCII-Editor. --- Copies the text, that is entered and the "exit"-command in lpr lprm sudo when reported to root) ------Prints a file Removes file from Printing Queue Executes file with SuperUser-Rights (Only user is in SUID-List, else it will be
Part 2: Working with archives ----------------------------tar -cvf the files (uncompressed) tar -xpvf archive tar -tf | less gzip have to archive the files with tar and then gzip them. tar -zxf This will give you a file.tar.gz --- Decompresses and Extracts the files ----Creates and stores
in this archive --- Extracts the files from the --Shows the contents of an archive
Compresses the gzip can only compress one file, so you'll
tar -M -cvf /dev/fd0h1440 floppy discs) tar -M -xpvf /dev/fd0h1440
-----
Creates a Multi-Volume-Archive (for Extracts a Multi-Volume-Archive
Part 3: Working with filesystems -------------------------------Formatting a Floppy Disc.
Step 1 -- Format the disc fdformat /dev/fd0H1440 Step 2 -- Create a Filesystem on the disc mkfs -t -c /dev/fd0H1440 stands for the filesystem. This can be ext2/minix/msdos (for floppys normal is minix)
To use a floppy disc or a cd-rom, you'll have to mount them before. mount Floppy: mount /dev/fd0 /floppy would be normal, CD-ROM: mount /dev/hdc /cdrom (you can use any directory, but floppy I think.)
Part 4: Working in Networks --------------------------Connect to a remote machine, and execute programs on it. telnet remote.host.org machine in the terminal. uname -a w is running finger information about specific users passwd write [] terminal, you can specify it in . To answer you, the must also start "write" chsh --Changes the login shell --Change User Password ----Gives information about the current system Shows who is currently logged in and what he --- Shows who is logged in. With "finger " you can get more --- Connect to a remote machine You can then execute programs on the remote
--- Write a message to . If is logged on more than one
Part 5: Programming -------------------
cc -o